package com.l024.easyandroidlib.log.log;

import java.text.SimpleDateFormat;
import java.util.Locale;

/**
 * @author wu_ming_zhi_bei
 * @date 2021/1/29 9:42
 * @Notes 日志可视化模型类
 */
public class EasyLogMo {
    public static SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd HH:mm:ss", Locale.CHINA);
    public long timeMillis;
    public int level;
    public String tag;
    public String log;

    public EasyLogMo(long timeMillis, int level, String tag, String log) {
        this.timeMillis = timeMillis;
        this.level = level;
        this.tag = tag;
        this.log = log;
    }

    //返回打印
    public String flattenedLog(){
        return getFlattened()+"\n"+log;
    }

    //返回打印
    public String getFlattened(){
        return format(timeMillis)+"|"+level+"|"+tag+"|:";
    }

    //日期格式化
    private String format(long timeMillis) {
        return sdf.format(timeMillis);
    }
}
